﻿using System;
using GC_FFW.SoccerfameParser.Abstractions.Interfaces.Helpers;

namespace GC_FFW.SoccerfameParser.Helpers
{
	public class StringManager : IStringManager
	{
		#region IStringManager Members

		public string RemoveHTMLMarkup(string data)
		{
			if (string.IsNullOrWhiteSpace(data)
				|| data.IndexOf(GC_FFW.Common.Constants.Text.Symbols.GREATER_THAN, StringComparison.Ordinal) == -1
				|| data.IndexOf(GC_FFW.Common.Constants.Text.Symbols.LESS_THAN, StringComparison.Ordinal) == -1) return data;

			return string.Concat(
				data.Substring(0, data.IndexOf(GC_FFW.Common.Constants.Text.Symbols.LESS_THAN, StringComparison.Ordinal)),
				data.Substring(data.LastIndexOf(GC_FFW.Common.Constants.Text.Symbols.GREATER_THAN, StringComparison.Ordinal) + 1));
		}

		#endregion
	}
}
